package com.iRomantic.domain.entity;

import java.sql.Timestamp;
import java.util.List;
import java.util.UUID;

import com.iRomantic.config.Constant;
import com.jfinal.plugin.activerecord.Model;

/**
 * 用户
 * @author serenity
 *
 */
public class User extends Model<User> {
	
	public static final User DAO = new User();

	private static final long serialVersionUID = -5681532368484915804L;
	
	public User findBySimId(String simId){
		return this.findFirst("select * from t_user where simId=?", simId);
	}
	
	/**
	 * Save model.
	 */
	public boolean save(){
		this.set("id", UUID.randomUUID().toString());
		this.set("createTime",new Timestamp(System.currentTimeMillis()));
		return super.save();
	}
	
	/**
	 * 设置资源全路径
	 * @param list
	 */
	public void setUserProjectPath(User user){
		user.set("pictureUrl", Constant.OSS_PATH+Constant.USER_PICTURE+user.get("pictureUrl"));
	}
	

}
